<div class="form-group clearfix">
  <div class="form-inline pull-left">
    <button type="button" class="btn" [ngClass]="{'btn-success': status === '3','btn-default': status !== '3'}"
            (click)="status='3';_task_times='';task_times='';getDailyTaskList(1);">全部 ({{counts['count_3']}})
    </button>
    <button type="button" class="btn" [ngClass]="{'btn-success': status === '0','btn-default': status !== '0'}"
            (click)="status='0';getDailyTaskList(1);">待审核 ({{counts['count_0']}})
    </button>
    <button type="button" class="btn" [ngClass]="{'btn-success': status === '2','btn-default': status !== '2'}"
            (click)="status='2';getDailyTaskList(1);">未通过 ({{counts['count_2']}})
    </button>
    <button type="button" class="btn" [ngClass]="{'btn-success': status == '1','btn-default': status !== '1'}"
            (click)="status='1';getDailyTaskList(1);">已通过 ({{counts['count_1']}})
    </button>
  </div>
  <div class="pull-right">
    <label style="margin-left:20px;">
      <span>提交时间：</span>
    </label>
    <nz-datepicker style="width: 200px;" (ngModelChange)="_startDate=$event;_startValueChange()" [ngModel]="_startDate" [nzDisabledDate]="_disabledStartDate" [nzFormat]="'YYYY-MM-DD'" [nzPlaceHolder]="'开始时间'"></nz-datepicker>
    <nz-datepicker style="width: 200px;" (ngModelChange)="_endDate=$event;_endValueChange()" [ngModel]="_endDate" [nzDisabledDate]="_disabledEndDate"  [nzFormat]="'YYYY-MM-DD'" [nzPlaceHolder]="'结束时间'"></nz-datepicker>
    <nz-select [nzDisabled]="status=='3'?true:false" style="width: 120px;" [(ngModel)]="_task_times">
      <nz-option
        nzLabel="全部"
        [nzValue]="''">
      </nz-option>
      <nz-option
        nzLabel="第一次任务"
        [nzValue]="1">
      </nz-option>
      <nz-option
        nzLabel="第二次任务"
        [nzValue]="2">
      </nz-option>
      <nz-option
        nzLabel="第三次任务"
        [nzValue]="3">
      </nz-option>
    </nz-select>
    <button [nzType]="'primary'" nz-button (click)="search1()">搜索</button>
    <button  nz-button (click)="reset()">重置</button>

  </div>

</div>
<div class="table-responsive">
  <nz-spin [nzTip]="'正在读取任务列表...'" [nzSpinning]="_isSpinning" [nzSize]="'large'" class="admin-spin">
    <table class="table">
      <thead>
      <tr>
        <th>用户名称</th>
        <th style="width:200px;">openId</th>
        <th style="width:400px;">任务图片</th>
        <th style="width:200px;" *ngIf="status === '3' || status === '1'">任务积分</th>
        <th style="width:200px;">审核状态</th>
        <th style="width:200px;">提交时间</th>
        <th style="width:200px;" *ngIf="status === '0' || status === '3'">操作</th>
      </tr>
      </thead>
      <tbody>
      <tr *ngFor="let item of dailyList">
        <td  style="width:400px;word-break: break-all;">{{ item.member?.nickName }}</td>
        <td>{{ item.member?.openId }}</td>
        <td>
          <img style="width:50px;height:50px;margin-right:10px;cursor: pointer;" *ngFor="let pic of item.upload_pic;"
               src="{{ aliyunOssOutputUrl + '/' + pic.pic_url }}" class="task-preview" (click)="showPreview($event)">
        </td>
        <td *ngIf="status === '3' || status === '1'">{{ item.point }}</td>
        <td *ngIf="item.status === 0"><span class="status-radio noauth-radio"></span>待审核</td>
        <td *ngIf="item.status === 1"><span class="status-radio success-radio"></span>已通过</td>
        <td *ngIf="item.status === 2"><span class="status-radio error-radio"></span>未通过<span *ngIf="item.err_code_des">({{ item.err_code_des }})</span></td>
        <td>{{ item.created_at }}</td>
        <td *ngIf="status === '0' || status === '3'">
          <a href="javascript:;" *ngIf="item.status === 0" (click)="showRejectModal(item)">不通过</a>
          <a href="javascript:;" *ngIf="item.status === 0" (click)="showPassModal(item)">通过</a>
        </td>
      </tr>
      </tbody>
    </table>
  </nz-spin>
  <div class="text-center">
    <pagination (pageChanged)="pageChanged($event)" [totalItems]="dailyTotal" [(ngModel)]="currentPage"
                [itemsPerPage]="itemsPerPage"
                [maxSize]="10"
                previousText="&lsaquo;" nextText="&rsaquo;" firstText="&laquo;" lastText="&raquo;"
                [boundaryLinks]="true" class="pagination-sm">
    </pagination>
  </div>
</div>
<app-notification [type]="type" [message]="message" [isShow]="isShow"
                  (promptIsShow)="isShow = $event;"></app-notification>


<!-- 拒绝Modal -->
<div class="modal fade" bsModal #rejectModal="bs-modal" tabindex="-1">
  <div class="modal-dialog modal-xs">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title pull-left">任务审核:</h4>
        <button type="button" class="close pull-right" aria-label="Close" (click)="rejectModal.hide();reject_result = '';">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form #addRejectForm="ngForm">
          <div class="form-group clearfix">
            <label class="col-md-2">拒绝理由:</label>
            <div class="col-md-8">
              <textarea type="text" class="form-control reject_result" id="reject_result"
                        (ngModelChange)="checkLength($event)" [(ngModel)]="reject_result" name="reject_result"
                        required></textarea>
            </div>
          </div>
          <div class="text-center mt20">
            <button class="btn btn-default btn-md-long" type="button" (click)="rejectModal.hide();reject_result = '';">取　消</button>
            <button class="btn btn-success btn-md-long" type="submit" (click)="addRejectFormSubmit()">提　交</button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

<div class="mask-box" style="display:none;" (click)="closeMask()"></div>

<!--<div class="mask" (click)="closeMask()">-->
  <div class="big-pic-wrap"  (click)="closeMask()">
    <div class="bigPic" [ngStyle]="{ 'background-image':'url('+editSrc+')'}"></div>
    <span class="close-pic">x</span>
  </div>
<!--</div>-->


<!-- 通过Modal -->
<div class="modal fade" bsModal #passModal="bs-modal" tabindex="-1">
  <div class="modal-dialog modal-xs">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title pull-left">设置积分</h4>
        <button type="button" class="close pull-right" aria-label="Close" (click)="passModal.hide();integral = null;other_intergral = '';activeIntergral = 5;">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form #addPassForm="ngForm" (ngSubmit)="addPassFormSubmit()">
          <div class="form-group clearfix">
            <div class="intergral-info">
              <span class="intergral-btn" [ngClass]="{'active': activeIntergral === 0}"
                    (click)="integral = '300';activeIntergral = 0;other_intergral = '';">300</span>
              <span class="intergral-btn" [ngClass]="{'active': activeIntergral === 1}"
                    (click)="integral = '500';activeIntergral = 1;other_intergral = '';">500</span>
              <span class="intergral-btn" [ngClass]="{'active': activeIntergral === 2}"
                    (click)="integral = '800';activeIntergral = 2;other_intergral = '';">800</span>
              <span class="intergral-btn" [ngClass]="{'active': activeIntergral === 3}"
                    (click)="integral = '1000';activeIntergral = 3;other_intergral = '';">1000</span>
            </div>
            <div class="intergral-info">
              <label class="col-md-2">其他积分:</label>
              <div class="col-md-10">
                <input type="text" class="form-control" id="other_intergral" [ngModelOptions]="{standalone: true}"
                       [(ngModel)]="other_intergral" name="other_intergral"
                       (ngModelChange)="clearIntergral();">
              </div>
            </div>
          </div>
          <div class="text-center mt20">
            <button class="btn btn-default btn-md-long" type="button" (click)="passModal.hide();integral = null;other_intergral = '';activeIntergral = 5;">取　消</button>
            <button class="btn btn-success btn-md-long" type="submit" [disabled]="!addPassForm.form.valid">提　交
            </button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

